#!/bin/bash

read -p "Enter regexp to remove > " input

# log_reg=".*2022-12-05-.*-15-29-00.*"
# log_reg=".*2022-12-05.*"  # "15-29-00.*"
log_reg=${input}

dir_list=("./log/tmp/" "./results/tmp/")
# dir_list=("./log/a/" "./log/b/")
cwd=`pwd`

for var in ${dir_list[@]}
do
    find=`ls ${var} | grep -e ${log_reg}` # } #| xargs -d"\n" echo
    cd $var
    sudo rm -r ${find}
    cd $cwd
done